package com.doit.demo03;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

public class test01_exception {
    public static void main(String[] args) {
        InputStream in=null;
        try {
                in = new FileInputStream("d:\\work\\abc\\2.txt");
                int len =0 ;//得到的长度
                byte[] b = new byte[1024];//一次性可存储的数据长度
                while ((len=in.read(b))!=-1){
                    System.out.print(new String(b,0,len));
                }
        }catch(IOException e){
            e.printStackTrace();
            }finally{
                try {
                    if (in != null)
                    {
                        in.close();
                    }
                }catch (IOException e){
                    e.printStackTrace();
                }
        }
    }
}
